package frontend.model.admin;

import backend.model.admin.Workplace;
import frontend.model.base.UIModel;

public class WorkplaceUIModel implements UIModel<Workplace> {

    private String name;
    private String description;
    private boolean isDeducted;
    private boolean isActive;

    private Workplace workplace;

    public WorkplaceUIModel() {
        workplace = new Workplace();
        isActive = true;
    }

    public WorkplaceUIModel(Workplace workplace) {
        this.workplace = workplace;
        populateFieldsFromDBModel();
    }

    @Override
    public void populateFieldsFromDBModel() {
        name = workplace.getName();
        description = workplace.getDescription();
        isDeducted = workplace.getIsDeducted();
        isActive = workplace.getIsActive();
    }

    @Override
    public void populateDBModelFromFields() {
        workplace.setDescription(description);
        workplace.setName(name);
        workplace.setIsDeducted(isDeducted);
        workplace.setIsActive(isActive);
    }

    public String getName() {
        return name;
    }

    public String getDescription() {
        return description;
    }

    public boolean getIsDeducted() {
        return isDeducted;
    }

    @Override
    public Workplace getDBModel() {
        return workplace;
    }
}
